package es.pawer.android.listacompras.data;

import java.util.Date;

/**
 * Each shopping list is just a list of goods with a given name.
 * Goods are being selected as they are taken from the shops.
 * @author plozano
 *
 */
public class ShoppingListTO implements ITransferObject {
	
	private static final long serialVersionUID = 537382430835859456L;
	
	private String name;
	private Date created;
	private long id;
	
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public ShoppingListTO(String n) {
		this.name=n;
		this.created=new Date();
	}
	
	/**
	 * Empty constructor
	 */
	public ShoppingListTO() {}
	
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date creationDate) {
		this.created = creationDate;
	}

	

	public int compareTo(ITransferObject g) {
		if (g!=null && g instanceof ShoppingListTO) {
			ShoppingListTO list=(ShoppingListTO)g;
			if (this.id==list.id) {
				return 0;
			}
			if (this.id<list.id) {
				return -1;
			}
		}
		return 1;
	}
}
